Dart.PowerTCP.SslSockets Namespace > Ping Class > Send Method : Send(String,Int32,Int32,String,Byte[]) Method |
Determine if a host is reachable, specifying a TTL, sequence number, and additional data to send.
[Visual Basic]
Overloads Public Function Send( _
ByVal remoteHost As String, _
ByVal TTL As Integer, _
ByVal sequenceNumber As Integer, _
ByVal localHost As String, _
ByVal data() As Byte _
) As EchoResult
[C#]
public EchoResult Send(
string remoteHost,
int TTL,
int sequenceNumber,
string localHost,
byte[] data
);
[C++]
public: EchoResult* Send(
string* remoteHost,
int TTL,
int sequenceNumber,
string* localHost,
byte[]* data
)
[C++/CLI]
public:
EchoResult^ Send(
String^ remoteHost,
int TTL,
int sequenceNumber,
String^ localHost,
bytearray<data>^ data
)
An EchoResult object describing the Ping response received.
Exception | Description |
---|---|
SocketException | The remote address is unknown, invalid, or unable to be resolved. |
This method pings the host specified by remoteHost with the settings specified by remoteHost, TTL, sequenceNumber, localHost, and data. An EchoResult object is returned from the method. Check the properties of the EchoResult for data about the Ping operation. For example, ResponseTime returns the amount of time for the response to be received.
The following example demonstrates a ping operation with specified settings.
[Visual Basic]
Try
' Ping a host with specified data, TTL, Sequence number, etc.
Dim data As Byte() = System.Text.Encoding.Default.GetBytes("**************")
Dim er As EchoResult = Ping1.Send("www.dart.com", 20, 1, "192.168.0.83", data)
' Display results
Debug.WriteLine("Response from www.dart.com")
Debug.WriteLine("Sequence number " + er.Sequence)
Debug.WriteLine("Delay " + er.ResponseTime)
Debug.WriteLine("Bytes " + er.Data.Length)
Catch ex as Exception
Debug.WriteLine("Cannot reach www.dart.com")
End Try
[C#]
try
{
// Ping a host with specified data, TTL, Sequence number, etc.
byte[] data = System.Text.Encoding.Default.GetBytes("**************");
EchoResult er = ping1.Send("www.dart.com", 20, 1, "192.168.0.83", data);
// Display results
Debug.WriteLine("Response from www.dart.com");
Debug.WriteLine("Sequence number " + er.Sequence);
Debug.WriteLine("Delay " + er.ResponseTime);
Debug.WriteLine("Bytes " + er.Data.Length);
}
catch(Exception ex)
{
Debug.WriteLine("Cannot reach www.dart.com");
}
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Ping Class | Ping Members | Overload List
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.